package com.geekhalo.domainevent.v4;

import com.geekhalo.domainevent.service.RecalculateRecommendCommand;
import com.geekhalo.domainevent.service.RecommendService;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@RocketMQMessageListener(topic = "order-service-topic", consumerGroup = "recommend-group")
public class RecommendConsumer  implements RocketMQListener<MessageExt> {
    @Autowired
    private RecommendService recommendService;

    @Override
    public void onMessage(MessageExt message) {
        RecalculateRecommendCommand recalculateRecommendCommand = buildRecalculateRecommendCommand...
        this.recommendService.recalculate(recalculateRecommendCommand);
    }
}
